class student:
    name='张三'
    age=18
    def study(self):
        print(f"{self.name}开始学习了")

student1=student()
setattr(student1,'major','软件技术')
setattr(student1,'school','西山小学')
delattr(student1,'school')
srt=input('请输入:')
print(f"student1是否有{srt}属性或方法:{hasattr(student1,srt)}")
if hasattr(student1,srt):
    print(f"student1的{srt}属性或方法:{getattr(student1,srt)}")